package com.cn.serv

import com.cn.mapper.UsersMapper
import com.cn.model.Users
import org.springframework.stereotype.Service
import java.time.LocalDateTime
import javax.annotation.Resource

@Service
class UserServiceImpl : UserService {
    @Resource
    private lateinit var userMapper: UsersMapper

    override fun add(user: Users): Int {
        println(user)
        return userMapper.insert(user)
    }

    override fun getUserById(id: Long): Users? {
        return userMapper.selectById(id)
    }

    override fun getAllUsers(): List<Users>? {
        return userMapper.selectList(null)
    }

    override fun test(): String {
        return LocalDateTime.now().toString()
    }
}    